package cn.anecansaitin.inet.mixins;

import cn.anecansaitin.inet.TranslateHelper;
import mcjty.lib.container.GenericContainer;
import mcjty.lib.gui.GenericGuiContainer;
import mcjty.lib.gui.ManualEntry;
import mcjty.lib.gui.Window;
import mcjty.lib.gui.widgets.AbstractContainerWidget;
import mcjty.lib.gui.widgets.ToggleButton;
import mcjty.xnet.modules.wireless.blocks.TileEntityWirelessRouter;
import mcjty.xnet.modules.wireless.client.GuiWirelessRouter;
import mcjty.xnet.setup.XNetMessages;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.player.Inventory;
import org.spongepowered.asm.mixin.Mixin;

import java.util.List;

@Mixin(GuiWirelessRouter.class)
public abstract class WirelessRouterGuiMixin extends GenericGuiContainer<TileEntityWirelessRouter, GenericContainer> {
    public WirelessRouterGuiMixin(TileEntityWirelessRouter tileEntity, GenericContainer container, Inventory inventory, ManualEntry manualEntry) {
        super(tileEntity, container, inventory, manualEntry);
    }

    @Override
    public void init() {
        this.window = new Window(this, this.tileEntity, XNetMessages.INSTANCE, new ResourceLocation("xnet", "gui/wireless_router.gui"));
        AbstractContainerWidget<?> toplevel = (AbstractContainerWidget<?>) window.getToplevel();
        ToggleButton button = (ToggleButton) toplevel.getChildren().get(0);
        button.text(TranslateHelper.getText("inet.wireless_router.button.name"));
        List<String> tooltips = button.getTooltips();
        tooltips.set(0, TranslateHelper.getText("inet.wireless_router.button.tooltip1"));
        tooltips.set(1, TranslateHelper.getText("inet.wireless_router.button.tooltip2"));
        super.init();
    }
}
